const Router = require('koa-router')
const PlaceController = require('../controllers/place.controller')
const jwt = require('../middlewares/jwt.middleware')

const router = new Router()
const placeController = new PlaceController()
router.prefix('/api/places')

router.get('/', jwt, placeController.findAll)

router.post('/', jwt, placeController.addOne)

router.get('/:id', jwt, placeController.findOne)

router.patch('/:id', jwt, placeController.updateOne)

router.delete('/:id', jwt, placeController.deleteOne)

module.exports = router